package cn.hdustea.shopNavigation.ui.presenter

import cn.hdustea.shopNavigation.entity.Store
import cn.hdustea.shopNavigation.ui.contract.StoreContract
import cn.hdustea.shopNavigation.ui.model.StoreModel
import com.hdustea.base.base.BasePresenter

/**
 * <pre>
 *     author : HuQiang
 *     time   : 2020/09/22
 *     desc   :
 *     version: 1.0
 * </pre>
 */
class StorePresenter(mView: StoreContract.View) : BasePresenter<StoreContract.View, StoreContract.Model>(mView), StoreContract.Presenter {

    override fun getModel(): StoreContract.Model = StoreModel()

    override fun getStoreList(page: Int, isRefresh: Boolean) {
        mModel.getStoreList(page, object : PresenterCallback<MutableList<Store>>() {
            override fun callback(data: MutableList<Store>) {
                mView?.dismissLoading()
                mView?.setStoreList(data, isRefresh)
            }
        })
    }

}